<template>
  <div>
    <a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol">
      <a-row :gutter="24">
        <a-col :span="8">
          <a-form-model-item label="项目状态">
            <a-select v-model="dataForm.projectStatus">
              <a-select-option v-for="item of projectList" :key="item.key">
                {{ item.name }}
              </a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="8">
          <a-form-model-item label="项目编号">
            <a-input v-model="dataForm.projectNo" allowClear :maxLength="100"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="8">
          <a-form-model-item label="项目名称">
            <a-input v-model="dataForm.projectName" allowClear :maxLength="100"/>
          </a-form-model-item>
        </a-col>
      </a-row>
      <a-row :gutter="24">
        <a-col :span="8">
          <a-form-model-item label="成果交易单号">
            <a-input v-model="dataForm.cgNo" allowClear />
          </a-form-model-item>
        </a-col>
        <a-col :span="8">
          <a-form-model-item label="科技成果名称">
            <a-input v-model="dataForm.cgName" allowClear />
          </a-form-model-item>
        </a-col>
        <a-col :span="8">
          <a-form-model-item label="交易类型">
            <a-select v-model="dataForm.tranType" placeholder="请选择">
              <a-select-option v-for="(item, index) in tranTypeList" :key="index" :value="item.code">
                {{item.name}}
              </a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>        
      </a-row>
    </a-form-model>
  </div>
</template>
<script>
  import {codeInfoList} from '@/api/codeInfo'
export default {
  name: 'AdvancedSearch',
  props: {
    dataForm: {},
  },
  data() {
    return {
      labelCol: { span: 8 },
      wrapperCol: { span: 15 },      
      form: {},
      projectList: [
        { name: '创建中', key: 1 },
        { name: '审核中', key: 2 },
        { name: '已完成', key: 3 },
      ],
      tranTypeList:[],
    }
  },
  watch: {
    dataForm: {
      handler(val, oldVal) {
        this.form = val
      },
      deep: true,
      immediate: true,
    },
  },
  mounted() {
    codeInfoList({type:'成果交易类型',pageSize:-1,isdel: 0}).then((res) => {
      if (res.code == 200) {
        this.tranTypeList = res.result.records
      } else {
        this.$message.warning('操作异常:' + res.message)
      }
    }).catch((res) => {
      this.$message.warning('操作异常:' + res.message)
    })
    codeInfoList({type:'成果交易类型',pageSize:-1,isdel: 0}).then((res) => {
      if (res.code == 200) {
        this.tranTypeList = res.result.records
      } else {
        this.$message.warning('操作异常:' + res.message)
      }
    }).catch((res) => {
      this.$message.warning('操作异常:' + res.message)
    })
  },
  methods: {
    resetForm(){
      this.dataForm.projectStatus = undefined
      this.dataForm.projectNo = ''
      this.dataForm.projectName = ''
      this.dataForm.cgNo = ''
      this.dataForm.tranType = undefined
      this.dataForm.cgName = ''
    }
  },
}
</script>
<style lang="less" scoped></style>
